/**
 * 发展历程
 * 模型
 */
const { DataTypes } = require("sequelize");
const sequelize = require("../conf/database"); // 引入数据库连接

// 定义 company_history 模型
module.exports = sequelize.define(
  "company_history",
  {
    h_id: {
      type: DataTypes.INTEGER.UNSIGNED,
      primaryKey: true,
      autoIncrement: true,
      allowNull: false,
      comment: "发展历程主键 ID",
    },
    date: {
      type: DataTypes.DATE,
      allowNull: false,
      unique: true,
      comment: "发展历程日期",
    },
    content: {
      type: DataTypes.STRING(255),
      allowNull: false,
      comment: "发展历程内容",
    },
    create_time: {
      type: DataTypes.DATE,
      defaultValue: DataTypes.NOW,
      allowNull: true,
      comment: "创建时间",
    },
    update_time: {
      type: DataTypes.DATE,
      defaultValue: DataTypes.NOW,
      allowNull: true,
      comment: "更新时间",
    },
    delete_time: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "删除时间",
    },
  },
  {
    tableName: "company_history", // 映射表名
    timestamps: true, // 不使用自动生成的 `createdAt` 和 `updatedAt` 字段
    paranoid: true, // 启用逻辑删除
    createdAt: "create_time",
    updatedAt: false,
    deletedAt: "delete_time",
  }
);
